package io.renren.modules.canteens.dao;

import io.renren.common.dao.BaseDao;
import io.renren.modules.canteens.dto.CollarDTO;
import io.renren.modules.canteens.entity.CollarEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 辅材领用表
 *
 * @author 罗胜平 781757616@qq.com
 * @since 1.0.0 2019-11-22
 */
@Mapper
public interface CollarDao extends BaseDao<CollarEntity> {
    @Select("SELECT  sum(b.unit_price*b.arrival_num) as totalPrice,A.* FROM canteens_collar A ,canteens_collarmx B where a.collar_id = b.collar_id " +
            "and  A.status>=4 and A.canteen_id = '${canteenId}' ${createDate}  GROUP BY A.collar_id  ${paging}")
    List<CollarDTO> getOrderList(String  createDate, long canteenId, String paging);
    @Select("SELECT  sum(b.unit_price*b.arrival_num)as totalPrice,A.* FROM canteens_collar A ,canteens_collarmx B where a.collar_id = b.collar_id " +
            "and  A.status>=4 and A.canteen_id = '${canteenId}' ${createDate} ")
    CollarDTO getOrdertotalMony(String  createDate,long canteenId);

    @Select(" SELECT  COUNT(*) as totalPage FROM canteens_collar A where  A.status>=4  and  canteen_id = '${canteenId}' ${createDate}")
    CollarDTO getTotalPage(String  createDate,long canteenId);
}